object dmbanco: Tdmbanco
  OldCreateOrder = True
  OnCreate = DataModuleCreate
  OnDestroy = DataModuleDestroy
  Left = 201
  Top = 118
  Height = 499
  Width = 774
  object ADOConnection1: TADOConnection
    ConnectionString = 
      'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\banco CSU\banco.' +
      'mdb;Mode=Share Deny None;Persist Security Info=False;Jet OLEDB:S' +
      'ystem database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database ' +
      'Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking M' +
      'ode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk ' +
      'Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Crea' +
      'te System Database=False;Jet OLEDB:Encrypt Database=False;Jet OL' +
      'EDB:Don'#39't Copy Locale on Compact=False;Jet OLEDB:Compact Without' +
      ' Replica Repair=False;Jet OLEDB:SFP=False'
    ConnectionTimeout = 30
    LoginPrompt = False
    Provider = 'Microsoft.Jet.OLEDB.4.0'
    AfterConnect = DataModuleCreate
    Left = 40
    Top = 16
  end
  object tb_dispositivos: TADOTable
    Connection = ADOConnection1
    CursorType = ctUnspecified
    IndexName = 'PrimaryKey'
    TableName = 'dispositivos'
    Left = 600
    Top = 88
  end
  object ds_dispositivos: TDataSource
    DataSet = tb_dispositivos
    Left = 600
    Top = 136
  end
  object tb_usuarios: TADOTable
    Connection = ADOConnection1
    CursorType = ctDynamic
    IndexName = 'PrimaryKey'
    TableName = 'usuarios'
    Left = 440
    Top = 88
  end
  object tb_agenda: TADOTable
    Connection = ADOConnection1
    CursorType = ctDynamic
    IndexName = 'PrimaryKey'
    MasterSource = ds_tipo_agenda
    TableName = 'agendamentos'
    Left = 192
    Top = 88
  end
  object tb_tipo_agenda: TADOTable
    Connection = ADOConnection1
    CursorType = ctDynamic
    IndexName = 'PrimaryKey'
    TableName = 'tipo_agendamento'
    Left = 688
    Top = 88
  end
  object tb_setores: TADOTable
    Connection = ADOConnection1
    CursorType = ctDynamic
    IndexName = 'PrimaryKey'
    TableName = 'setores'
    Left = 32
    Top = 88
  end
  object tb_setor_usuario: TADOTable
    Connection = ADOConnection1
    CursorType = ctDynamic
    IndexName = 'id_usuario'
    TableName = 'setor_usuario'
    Left = 272
    Top = 88
  end
  object ds_usuarios: TDataSource
    DataSet = tb_usuarios
    Left = 440
    Top = 136
  end
  object ds_agenda: TDataSource
    DataSet = tb_agenda
    Left = 192
    Top = 136
  end
  object ds_tipo_agenda: TDataSource
    DataSet = tb_usuarios
    Left = 688
    Top = 136
  end
  object ds_setores: TDataSource
    AutoEdit = False
    DataSet = tb_setores
    Left = 32
    Top = 136
  end
  object ds_setor_usuario: TDataSource
    DataSet = tb_setor_usuario
    Left = 272
    Top = 136
  end
  object ds_estado: TDataSource
    DataSet = tb_estados
    Left = 112
    Top = 136
  end
  object tb_estados: TADOTable
    Connection = ADOConnection1
    IndexName = 'PrimaryKey'
    TableName = 'estados'
    Left = 112
    Top = 88
  end
  object ds_dados_dispositivos: TDataSource
    DataSet = set_dispositivos
    Left = 56
    Top = 384
  end
  object set_usuario_endereco: TADOQuery
    Connection = ADOConnection1
    DataSource = ds_usuarios
    Parameters = <>
    SQL.Strings = (
      
        'SELECT U.*, E.* FROM USUARIOS U INNER JOIN ENDERECOS E ON U.ID=E' +
        '.ID_USUARIO')
    Left = 336
    Top = 328
  end
  object ds_usuario_endereco: TDataSource
    DataSet = set_usuario_endereco
    Left = 336
    Top = 384
  end
  object set_dispositivos: TADOQuery
    Connection = ADOConnection1
    DataSource = ds_dispositivos
    Parameters = <>
    SQL.Strings = (
      
        'SELECT D.ID, D.NOME, E.OPERACAO, S.DESCRICAO FROM SETORES S INNE' +
        'R JOIN (ESTADOS E INNER JOIN DISPOSITIVOS D ON D.ID_ESTADO=E.ID)' +
        ' ON D.ID_SETOR=S.ID')
    Left = 56
    Top = 328
  end
  object set_radios: TADOQuery
    Connection = ADOConnection1
    DataSource = ds_dispositivos
    Parameters = <>
    Left = 144
    Top = 328
  end
  object ds_radios: TDataSource
    DataSet = set_radios
    Left = 144
    Top = 384
  end
  object tb_enderecos: TADOTable
    Connection = ADOConnection1
    IndexName = 'PrimaryKey'
    TableName = 'enderecos'
    Left = 360
    Top = 88
  end
  object ds_enderecos: TDataSource
    DataSet = tb_enderecos
    Left = 360
    Top = 136
  end
  object set_agendamentos: TADOQuery
    Connection = ADOConnection1
    DataSource = ds_agenda
    Parameters = <>
    SQL.Strings = (
      'SELECT'
      'A.ID, U.NOME AS Usuario,'
      'S.DESCRICAO AS Setor,'
      'A.OPERACAO_INI AS Opera'#231#227'o_inicial,'
      'A.OPERACAO_FIM AS Opera'#231#227'o_final,'
      'TP.DESCRICAO AS Tipo_agendamento,'
      'A.DATA_INI AS Data_inicial,'
      'A.DATA_FIM AS Data_final,'
      'A.HORA_INI AS Hora_inicial,'
      'A.HORA_FIM AS Hora_final,'
      'ST.SITUACAO AS Situa'#231#227'o'
      'FROM'
      '(((AGENDAMENTOS A INNER JOIN USUARIOS U'
      'ON'
      'U.ID=A.ID_USUARIO)'
      
        'INNER JOIN SETORES S ON A.ID_SETOR=S.ID) INNER JOIN TIPO_AGENDAM' +
        'ENTO TP ON A.ID_TIPO=TP.ID)'
      'INNER JOIN SITUACOES ST ON ST.ID=A.ID_SITUACAO  WHERE ST.ID=1')
    Left = 224
    Top = 328
  end
  object ds_agendamento: TDataSource
    DataSet = set_agendamentos
    Left = 224
    Top = 384
  end
  object tb_dispositivos_agendados: TADOTable
    Connection = ADOConnection1
    TableName = 'dispositivos_agendados'
    Left = 272
    Top = 16
  end
  object ds_dispositivos_agendados: TDataSource
    DataSet = tb_dispositivos_agendados
    Left = 416
    Top = 16
  end
  object qrySetorPermicao: TADOQuery
    Connection = ADOConnection1
    CursorType = ctStatic
    DataSource = ds_setor_usuario
    Parameters = <
      item
        Name = 'P_ID_USUARIO'
        Attributes = [paSigned]
        DataType = ftInteger
        Size = 1
        Value = 0
      end>
    SQL.Strings = (
      'select * from setores'
      'where not exists( '
      
        'select setor_usuario.id_setor from setor_usuario where setor_usu' +
        'ario.id_usuario=:P_ID_USUARIO and setor_usuario.id_setor = setor' +
        'es.id)')
    Left = 456
    Top = 384
  end
  object qryPermicaoUsuario: TADOQuery
    Connection = ADOConnection1
    CursorType = ctStatic
    DataSource = ds_setor_usuario
    Parameters = <
      item
        Name = 'P_ID_USUARIO'
        Attributes = [paSigned]
        DataType = ftInteger
        Size = 1
        Value = 0
      end>
    SQL.Strings = (
      'select * from setores s, setor_usuario su'
      'where su.id_usuario=:P_ID_USUARIO and su.id_setor=s.id')
    Left = 464
    Top = 328
  end
  object util: TADOQuery
    Connection = ADOConnection1
    DataSource = ds_usuarios
    Parameters = <>
    Left = 688
    Top = 208
  end
  object usuario_logado: TDataSource
    DataSet = util
    Left = 688
    Top = 256
  end
  object tb_setor_combo: TADOTable
    Connection = ADOConnection1
    MasterSource = ds_setores
    TableName = 'setores'
    Left = 520
    Top = 88
  end
  object ds_setor_combo: TDataSource
    DataSet = tb_setor_combo
    Left = 520
    Top = 136
  end
  object util_dispositivos: TADOQuery
    Connection = ADOConnection1
    DataSource = ds_dispositivos
    Parameters = <>
    SQL.Strings = (
      '')
    Left = 688
    Top = 320
  end
  object ds_util_dispositivos: TDataSource
    DataSet = util_dispositivos
    Left = 688
    Top = 376
  end
  object tb_tipo_usuario: TADOTable
    Connection = ADOConnection1
    TableName = 'tipo_usuario'
    Left = 32
    Top = 200
  end
  object ds_tipo_usuario: TDataSource
    DataSet = tb_tipo_usuario
    Left = 32
    Top = 256
  end
end
